const collectionKey = 'businessCollectionCountList';
const collectionKeyName = 'business';
const likeCountKey = 'businesslikeCountList';
const likeCountKeyName = 'business';
var businessUtils = {
    //商圈关注
    collectionKeyName:collectionKeyName,
    getCollectionCountList() {
        return uni.getStorageSync(collectionKey);
    },
    setCollectionCountList(list) {
        uni.setStorageSync(collectionKey, list);
    },
    setCollectionCount(keyName, value) {
        keyName = collectionKeyName+keyName;
        let list = this.getCollectionCountList();
        if (list) {
            list[keyName] = value;
        } else {
            list = {};
            list[keyName] = value;
        }
        this.setCollectionCountList(list);
    },
    isExistCollectionKey(keyName) {
        keyName = collectionKeyName+keyName;
        let list = this.getCollectionCountList();
        if (list && list[keyName]) {
            return true;
        }
        return false;
    },

    //商圈点赞
    likeCountKeyName: collectionKeyName,
    getLikeCountList() {
        return uni.getStorageSync(likeCountKey);
    },
    setLikeCountList(list) {
        uni.setStorageSync(likeCountKey, list);
    },
    setLikeCount(keyName, value) {
        keyName = likeCountKeyName + keyName;
        let list = this.getLikeCountList();
        if (list) {
            list[keyName] = value;
        } else {
            list = {};
            list[keyName] = value;
        }
        this.setLikeCountList(list);
    },
    isExistLikeCountKey(keyName) {
        keyName = likeCountKeyName + keyName;
        let list = this.getLikeCountList();
        if (list && list[keyName]) {
            return true;
        }
        return false;
    }
}
export default businessUtils;
